﻿Imports System.IO

''' <summary>
''' ParseFiles - actually parses the names of directories in the current
''' directory. This is basically to troll the file hunters. Creating the File
''' parses is also simple. Instead of GetDirectories, GetFiles can be used.
''' </summary>
''' <remarks>Custome Class to Parse File and Folder Names - Sarthak Ganguly</remarks>
Public Class ParseFiles
    ' Parse the file names in the directory
    Private Sub startButton_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles startButton.Click
        'Change the filesystem directory to the one given as input
        Dim file_name As String = tBox.Text + "\output.txt"
        My.Computer.FileSystem.CurrentDirectory() = tBox.Text
        Dim folderList = New DirectoryInfo(tBox.Text)
        Dim objWriter As New System.IO.StreamWriter(file_name)
        For Each file In folderList.GetDirectories()
            objWriter.WriteLine(file)
        Next
        objWriter.Close()
        ' Writing to text file is complete
    End Sub
End Class
